diff — Difference between matrix elements


\begin{rail}
Difference : 'diff' '(' Matrix ( ',' Scalar ) ? ')' ;
\end{rail}
diff calculates the difference between elements of the matrix argument. If the matrix is a vector, then diff returns a vector of the differences between adjacent elements. The return vector has one less element than the argument. If the argument is not a vector, then differences are calulated down each column, returning a matrix with one less row than the argument. If the optional scalar argument is present, it specifies the number of times differences are taken. For example, if it is 2, then the differences between the differences are returned. $\Longrightarrow$ This is not an built-in function. This function is normally loaded on start-up from the diff.r file in the standard rlib directory. Use of the -r option, incorrectly setting the RLAB_LIB_DIR environmental variable, or modifying diff.r may make this function unavailable.

Subsections